<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        function onclickway(){
            var a = document.getElementById("123");
            var c = document.getElementById("456");
            if (a.value == "123456"){
                c.innerHTML = "密码正确！";
                // innerHTML表示在<span> <span>之间输出内容
            }
            else{
                c.innerHTML = "密码错误！"; 
            }
        } 
    </script>
</head>
<body>
    用户密码：<input type="text" id="123" value="123456">
    <span style="color:red;" id="456"></span>
    <button onclick="onclickway();">确定</button>
</body>
</html>